package com.berrontech.asbog;

import android.util.Log;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;

/**
 * Create by levent8421 2021/4/9 21:13
 * SimpleWebViewClient
 * Web view client
 *
 * @author levent8421
 */
public class SimpleWebViewClient extends WebViewClient {
    private static final String TAG = "SimpleWebViewClient";

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
        view.loadUrl(request.getUrl().toString());
        return true;
    }

    @Override
    public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
        super.onReceivedError(view, request, error);
        Log.e(TAG, String.format("WebView error [%s]", error));
    }

    @Override
    public void onLoadResource(WebView view, String url) {
        super.onLoadResource(view, url);
        Log.i(TAG, "Load resource:" + url);
    }
}
